eventmonitor.htmlHTMLudog? πùΔ£πùΔ£ÅÅZÑ Monkeybread Realbasic plugin - Documentation - Eventmonitor

MBS Plugin Documentation

This is the documentation for the Realbasic Plugins from Monkeybreadsoftware.de. You find these plugins and the newest version of this document at http://www.monkeybreadsoftware.de/realbasic inside the plugins section.

This help was last updated on Freitag, 6. September 2002 and covers 2136 items: 126 classes, 2 controls and 583 global functions.

The list of the themes Global methods by category Global methods by name The list of the classes The list of the controls

class Eventmonitor

class, Eventmonitor So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: Does nothing.
Function: Defines a class for accessing all keyboard and mouse events before any Realbasic Eventhandler.
Notes:
This plugin gives you a class that allows you to monitor any events that your app receives from the outside, such as key presses, mouse movement, AppleEvents, any many more.

Contrary to the Events that RB's Controls, Windows and the Application class gives you, this plugin gives you the original event information. For example, when you want to receive key press events, RB's KeyDown event only gives you the character code of the key, which is insufficient to detect the F-keys or Shift, Control etc.

Additionally, you can modify any such event before further processing by the RB runtime.

This plugin works currently only in Mac OS, not with Windows.

In Realbasic 2.0 not all events where available, but in Realbasic 4.0.2 on Mac OS X 10.1.3 I'll see all events again.

If you want to filter events (by subclassing this class and using the Action event), set this variable to specify in which events you are interested. The value is a combination of bits, each bit represesenting one of the possible event types in the what property (0-15 and 23). For example, to check for keyDown events, set bit 3, which would be the value 8, or set bit 0 (value 1) in order to get null (idle) events. Default value is 0 (no events are passed to the Action event handler).

Action

event, Eventmonitor So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: does allways return 0.
Function: The Event you get in Realbasic when something is happending.
Notes:
The Action event is called each time thew running RB app receives any Event. The Action handler is called before RB handles the event any further. You may subclass this class in order to monitor and even modify any events using this Action handler. In the Action event handler, you can modify the following properties of this class in order to affect the event processing: what, message, modifiers.

For example, in order to filter an event completely so that it gets ignored by the rest of RB's event handling system, set the what property to zero.

In order to receive any Action events, you need to set actionEventMask to a non-zero value. Setting it to -1 lets you monitor any events the app receives.

See the enclosed RB project "Event Modification Demo" for an example on how to monitor keystrokes (including Shift, Control, Command, Option, Caps Lock) and modify them.

actionEventMask as integer

property, Eventmonitor So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: does allways return 0.
Function: The message of this event.
Notes: If you want to filter events (by subclassing this class and using the Action event), set this variable to specify in which events you are interested. The value is a combination of bits, each bit represesenting one of the possible event types in the what property (0-15 and 23). For example, to check for keyDown events, set bit 3, which would be the value 8, or set bit 0 (value 1) in order to get null (idle) events. Default value is 0 (no events are passed to the Action event handler).

message as integer

property, Eventmonitor So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: does allways return 0.
Function: The message of this event.
Notes:
Meaning depends on event kind:

null, mouse-up, mouse-down:
Undefined.

key-up, key-down, auto-key:
Character code and virtual key code in low-order word. For Apple Desktop Bus (ADB) keyboards, the low byte of the high-order word contains the ADB address of the keyboard where the keyboard event occurred. The high byte of the high-order word is reserved.

update, activate:
Pointer to the window to update, activate, or deactivate.

disk-inserted:
Drive number in low-order word, File Manager result code in high-order word.

resume:
The suspendResumeMessage constant in bits 24-31 and a 1 in bit 0 to indicate the event is a resume event. Bit 1 contains either a 1 or a 0 to indicate if Clipboard conversion is required, and bits 2-23 are reserved.

suspend:
The suspendResumeMessage constant in bits 24-31 and a 0 in bit 0 to indicate the event is a suspend event. Bit 1 is undefined, and bits 2-23 are reserved.

mouse-moved:
The mouseMovedMessage constant in bits 24-31. Bits 2-23 are reserved, and bit 0 and bit 1 are undefined.

high-level:
Class of events to which the high-level event belongs. The message and where fields of a high-level event define the specific type of high-level event received.

modifiers as integer

property, Eventmonitor So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: does allways return 0.
Function: State of mouse button, shift, ctrl, cmd, option etc.
Notes:
The modifiers field contains information about the state of the modifier keys and the mouse button at the time the event was posted. For activate events, this field also indicates whether the window should be activated or deactivated. In System 7 it also indicates whether the mouse-down event caused your application to switch to the foreground.

Each of the modifier keys is represented by a specific bit in the modifiers field of the event record. You can use these constants as masks to test the setting of various bits in the modifiers field:

activeFlag1set if window being activated or if mouse-down event caused foreground switch
btnState128set if mouse button up
cmdKey256set if Command key down
shiftKey512set if Shift key down
alphaLock1024set if Caps Lock key down
optionKey2048set if Option key down
controlKey4096set if Control key down
rightshiftKey8192set if right Shift key down
rightoptionKey16384set if right Option key down
rightcontrolKey32768set if right Control key down

If your application attaches special meaning to any of these keys in combination with other keys or when the mouse button is down, you can test the state of the modifiers field to determine the action your application should take. For example, you can use this information to determine whether the user pressed the Command key and another key to make a menu choice.

Some keyboards do not distinguish between the right or left Control, Shift, and Option keys; for example, the virtual key code for the right Shift key and left Shift key might be the same. For these keyboards, if the user presses the Control, Shift, or Option key, the Event Manager sets only the bits corresponding to the shiftKey, optionKey, and controlKey constants. For keyboards that do distinguish between these keys, the Event Manager sets the bits in the modifiers field to indicate whether the right or left Control, Shift, or Option keys were pressed. For example, the Event Manager sets bit 13 in the modifiers field if the user presses the right Shift key and sets bit 9 if the user presses the left Shift key. In most cases your application should not need to distinguish between the left and right Control, Shift, and Option keys.

what as integer

property, Eventmonitor So, 26. Mai 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: does allways return 0.
Function: kind of event.
Notes:
Possible values:

0no other pending events
1mouse button pressed
2mouse button released
3key pressed
4key released
5key repeatedly held down
8activate/deactivate window
15operating-system event (resume, suspend, or mouse-moved)
23high-level event (e.g. AppleEvent)

(There might be more event's but I don't see them now in Realbasic 4.0)

when as integer

property, Eventmonitor So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: does allways return 0.
Function: The time of the event.
Notes: The when field indicates the time when the event was posted (in ticks since system startup).

whereX as integer

property, Eventmonitor So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: does allways return 0.
Function: position of mouse when event occured (screen-global coords.)

whereY as integer

property, Eventmonitor So, 28. Apr 2002
Mac OS Classic: Works. Mac OS Carbon: Works. Windows: does allways return 0.
Function: position of mouse when event occured (screen-global coords.)

Contact

Written 2002 by Christian Schmitz. Feel free to ask or report mistakes to realbasic@macsw.de.
Thanks.

This resource fork intentionally left blank ˇˇ